home *** CD-ROM | disk | FTP | other *** search
- -- stack: in.2
- -- format: 8 (HyperCard 1)
- -- flags: 0x1000 (none)
- -- protect password hash: 0
- -- maximum user level: 5 (scripting)
- -- window: Rect(x1=0, y1=0, x2=0, y2=0)
- -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
- -- card dimensions: w=0 h=0
- -- scroll: x=0 y=0
- -- background count: 2
- -- first background id: 5072
- -- card count: 7
- -- first card id: 5256
- -- list block id: 4741
- -- print block id: 2457
- -- font table block id: 0
- -- style table block id: 0
- -- free block count: 0
- -- free size: 0 bytes
- -- total size: 50144 bytes
- -- stack block size: 13824 bytes
- -- created by hypercard version: 0x01208000
- -- compacted by hypercard version: 0x01228000
- -- modified by hypercard version: 0x01228000
- -- opened by hypercard version: 0x01228000
- -- patterns[0]: 0x0000000000000000
- -- patterns[1]: 0x8000000008000000
- -- patterns[2]: 0x8800220088002200
- -- patterns[3]: 0x8888222288882222
- -- patterns[4]: 0x88AA22AA88AA22AA
- -- patterns[5]: 0xCCAA33AACCAA33AA
- -- patterns[6]: 0xEEAABBAAEEAABBAA
- -- patterns[7]: 0xEEBBBBEEEEBBBBEE
- -- patterns[8]: 0xFFBBFFEEFFBBFFEE
- -- patterns[9]: 0xFFBBFFFFFFBBFFFF
- -- patterns[10]: 0x8010022001084004
- -- patterns[11]: 0xFFFFFFFFFFFFFFFF
- -- patterns[12]: 0x8822882288228822
- -- patterns[13]: 0x1122448811224488
- -- patterns[14]: 0xC4800C6843023026
- -- patterns[15]: 0xB130031BD8C00C8D
- -- patterns[16]: 0xAA00AA00AA00AA00
- -- patterns[17]: 0x8822552288225522
- -- patterns[18]: 0x8855225588552255
- -- patterns[19]: 0x77DD77DD77DD77DD
- -- patterns[20]: 0x8000000000000000
- -- patterns[21]: 0xAA55AA55AA55AA55
- -- patterns[22]: 0x038448300C020101
- -- patterns[23]: 0x8244394482010101
- -- patterns[24]: 0x8814224188412214
- -- patterns[25]: 0x8080413E080814E3
- -- patterns[26]: 0x22048C7422179810
- -- patterns[27]: 0xBE808808EB088880
- -- patterns[28]: 0x25C8328964244C92
- -- patterns[29]: 0xA29C41BE2AC914EB
- -- patterns[30]: 0x40A00000040A0000
- -- patterns[31]: 0x8040200002040800
- -- patterns[32]: 0xAA00800088008000
- -- patterns[33]: 0xFF80808080808080
- -- patterns[34]: 0x081C22C180010204
- -- patterns[35]: 0xFF808080FF080808
- -- patterns[36]: 0xF87422478F172271
- -- patterns[37]: 0xBF00BFBFB0B0B0B0
- -- patterns[38]: 0xFF7FBE5DA2418000
- -- patterns[39]: 0xFAF5FAF5A050A050
- -- checksum: 0x0
- ----- HyperTalk script -----
- ---------------------------------------------------------------------
- -- Groupies 3.0, a utility for grouping objects, by Sioux Lacy
- -- This stack is public domain. Happy grouping!
- --
- -- 04 May 1988 v2.1 revised for HyperCard version 1.2
- -- 07 May 1988 v2.2 added ability to copy the text in fields
- -- 01 June 1988 v2.3 revised to allow selection by dragging a rect
- -- 02 June 1988 v2.4 revised for use with functionKeys f5 thru f10
- -- 22 July 1988 v3.0 added equal space feature, revised presentation
- --
- -- Many thanks to Bill Atkinson for his help and encouragement
- ---------------------------------------------------------------------
-
- -- You don't need to copy this first handler to your Home stack
- -- unless you have an extended keyboard (with function keys).
-
- -- On an extended keyboard, this handler can be used to do Groupies
- -- messages by typing the function keys. It uses keys F5 thru F11.
-
- on functionKey whichKey
- global objectList
- if whichKey < 5 or whichKey > 11 then pass functionKey
- if whichKey is 5 then Group
- else if whichKey is 6 then Move
- else if whichKey is 7 then Copy
- else if whichKey is 8 then Paste
- else if whichKey is 9 then Erase
- else if whichKey is 10 then Align
- else if whichKey is 11 then Adjust
- end functionKey
-
- ---------------------------------------------------------------------
- -- GROUPIES HANDLERS START HERE
- ---------------------------------------------------------------------
-
- -- Message: Group
- -- This will let the user designate a number of objects to be grouped
- -- either by clicking on them, or showing a surrounding rectangle
-
- on Group
- global objectList, whereTheGroupIs
- put "Objects" into selectMethod -- default method
- if the optionKey is down then
- put Choice("Group objects by selecting:", "Objects", "Area") into selectMethod
- end if
- if selectMethod is "Objects" then
- Confirm "Click buttons or fields, then press command."
- put empty into objectList
- put empty into whereTheGroupIs
- repeat until the commandKey is down
- set cursor to arrow
- if the mouseClick then
- set cursor to watch
- put HitTest(the clickLoc) into hitWhat
- if hitWhat is not empty and hitWhat is not in objectList
- then put hitWhat & "," after objectList
- else beep -- invalid hit or nothing hit
- end if
- end repeat
- else -- selectMethod is "Area"
- Confirm "Use 2 clicks to show opposite corners of area."
- put empty into objectList
- put empty into whereTheGroupIs
- set cursor to cross
- wait until the mouseClick
- put the clickLoc into selectRect
- DrawMarker selectRect
- wait until the mouseClick
- put "," & the clickLoc after selectRect
- DrawMarker the clickLoc
- set cursor to watch
- EraseMarkers
- WithinRect selectRect
- end if
- delete last char of objectList -- get rid of trailing comma
- choose browse tool
- end Group
-
- -- Message: Move
- -- This will reposition (on the current card) all the
- -- grouped objects.
- -- They will follow the mouse location.
-
- on Move
- global objectList
- CheckGroup
- Confirm "Click and drag the group with mouse down."
- set cursor to arrow
- wait until the mouse is down
- put the mouseLoc into thisLoc
- repeat while the mouse is down
- put thisLoc into lastLoc
- put the mouseLoc into thisLoc
- if thisLoc is not lastLoc then
- put item 1 of thisLoc - item 1 of lastLoc into deltaX
- put item 2 of thisLoc - item 2 of lastLoc into deltaY
- lock screen
- repeat with i = 1 to the number of items in objectList
- put item i of objectList into object
- get location of object
- add deltaX to item 1 of it
- add deltaY to item 2 of it
- set location of object to it
- end repeat
- unlock screen
- end if
- end repeat
- end Move
-
- -- Message: Copy
- -- This will remember, in a global variable, the current card. Then,
- -- when the user 'pastes', the objects will be copied from that card.
-
- on Copy
- global whereTheGroupIs, savedUserLevel
- CheckGroup
- put the userLevel into savedUserLevel
- set the userLevel to 5 -- will be restored after 'Paste'
- Confirm "Go wherever you wish and 'Paste'."
- put the long id of this card into WhereTheGroupIs
- end Copy
-
- -- Message: Paste
- -- This will paste all the objects in the group into the current card /
- -- background. It must be preceded by 'Copy'.
-
- on Paste
- global objectList, WhereTheGroupIs, savedUserLevel
- CheckGroup
- if WhereTheGroupIs is empty
- then Abort "Please choose 'Copy' before 'Paste'."
- set cursor to watch
- set lockMessages to true
- lock screen
- repeat with i = 1 to the number of items in objectList
- push this card
- go to WhereTheGroupIs
- put item i of objectList into object
- if word 2 of object is "field"
- then put the value of object into copyOfText
- select object
- type "C" with commandKey
- pop card
- set editBkgnd to (word 1 of object = "bkgnd")
- type "V" with commandKey
- if word 2 of object is "field" then
- if word 1 of object is "bkgnd"
- then put copyOfText into bkgnd field (the number of bkgnd fields)
- else put copyOfText into card field (the number of card fields)
- end if
- end repeat
- choose browse tool
- unlock screen
- set the userLevel to savedUserLevel
- Prompt "These new objects are not grouped. The old group is still valid."
- end Paste
-
- -- Message: Erase
- -- This will delete all the objects in the group. They are removed
- -- from the stack, and the operation is not undoable.
-
- on Erase
- global objectList, WhereTheGroupIs
- CheckGroup
- Confirm "Deleting group is not undoable. Are you sure?"
- repeat with i = the number of items in objectList down to 1
- select item i of objectList
- type "X" with commandKey
- end repeat
- put empty into objectList
- put empty into WhereTheGroupIs
- choose browse tool
- end Erase
-
- -- Message: Align
- -- This will line up the objects flush left, right, top or bottom,
- -- depending on the user's wishes.
-
- on Align
- global objectList
- CheckGroup
- put Choice("Adjust members by moving them:","Left/Right","Up/Down") into axis
- if axis is "Up/Down"
- then answer "Align objects at:" with "Top" or "Bottom" or "Center"
- else answer "Align objects at:" with "Left" or "Right" or "Center"
- put it into alignment
- Confirm "Click where you wish them to align."
- set cursor to cross
- wait until the mouseClick
- if alignment is "Center" then
- repeat with i = 1 to the number of items in objectList
- put item i of objectList into object
- get location of object
- if axis is "Up/Down"
- then put the clickV into item 2 of it
- else put the clickH into item 1 of it
- set location of object to it
- end repeat
- else
- repeat with i = 1 to the number of items in objectList
- put item i of objectList into object
- if axis is "Up/Down" then
- if alignment is "Top"
- then set top of object to the clickV
- else set bottom of object to the clickV
- else if axis is "Left/Right" then
- if alignment is "Left"
- then set left of object to the clickH
- else set right of object to the clickH
- end if
- end repeat
- end if
- end Align
-
- -- Message: Adjust
- -- This will put an equal amount of 'white' space between consecutive
- -- objects in the group. Note that the objects must be in ascending
- -- order for this to work as expected.
-
- on Adjust
- global objectList
- CheckGroup
- put Choice("Adjust space between objects:","Horizontally","Vertically") into adjust
- Confirm "Use 2 clicks to show desired spacing."
- set cursor to cross
- wait until the mouseClick
- put the clickLoc into startLoc
- DrawMarker startLoc
- wait until the mouseClick
- put the clickLoc into endLoc
- DrawMarker endLoc
- SortGroup adjust
- if adjust = "Horizontally" then
- put abs(item 1 of endLoc - item 1 of startLoc) into horizSpace
- put right of item 1 of objectList into lastRight
- repeat with i = 2 to the number of items in objectList
- put item i of objectList into object
- set left of object to lastRight + horizSpace
- put right of object into lastRight
- end repeat
- else -- adjust "Vertically"
- put abs(item 2 of endLoc - item 2 of startLoc) into vertSpace
- put bottom of item 1 of objectList into lastBottom
- repeat with i = 2 to the number of items in objectList
- put item i of objectList into object
- set top of object to lastBottom + vertSpace
- put bottom of object into lastBottom
- end repeat
- end if
- EraseMarkers
- end Adjust
-
- -------------------------------------------------------------
-
- on Abort what
- answer what
- exit to HyperCard
- end Abort
-
- on CheckGroup
- global objectList
- if objectList is empty then Abort "There are no objects in the group."
- end CheckGroup
-
- function Choice prompt, choice1, choice2
- answer prompt with choice1 or choice2 or "Cancel"
- if it is "Cancel" then exit to HyperCard
- return it
- end Choice
-
- on Confirm what
- answer what with "Cancel" or "OK"
- if it is "Cancel" then exit to HyperCard
- end Confirm
-
- on DrawMarker where
- lock screen
- doMenu "New Button"
- put the number of card btns into newBtn
- set icon of card btn newBtn to "Marker Cross"
- set style of card btn newBtn to transparent
- set showName of card btn newBtn to false
- set rect of card btn newBtn to 0,0,20,20
- set loc of card btn newBtn to where
- set name of card btn newBtn to empty
- choose browse tool
- unlock screen
- end DrawMarker
-
- on EraseMarkers
- lock screen
- select card btn (the number of card btns)
- doMenu "Clear Button"
- select card btn (the number of card btns)
- doMenu "Clear Button"
- choose browse tool
- unlock screen
- end EraseMarkers
-
- function HitTest where
- repeat with i = the number of card buttons down to 1
- if where is within rect of card button i then
- if visible of card button i
- then return "card button id " & the id of card button i
- end if
- end repeat
- repeat with i = the number of card fields down to 1
- if where is within rect of card field i then
- if visible of card field i
- then return "card field id " & the id of card field i
- end if
- end repeat
- repeat with i = the number of bkgnd buttons down to 1
- if where is within rect of bkgnd button i then
- if visible of bkgnd button i
- then return "bkgnd button id " & the id of bkgnd button i
- end if
- end repeat
- repeat with i = the number of bkgnd fields down to 1
- if where is within rect of bkgnd field i then
- if visible of bkgnd field i
- then return "bkgnd field id " & the id of bkgnd field i
- end if
- end repeat
- return empty
- end HitTest
-
- on Prompt what
- put what
- put the seconds into startTime
- put the mouseLoc into startLoc
- wait until (the seconds = startTime+10) or (the mouseLoc <>¬ startLoc)
- put empty into message box
- hide message box
- end Prompt
-
- on SortGroup how
- global objectList
- put empty into sortedList
- if how is "Vertically" then put true into verticalSort
- else put false into verticalSort
- repeat with i = 1 to the number of items in objectList
- put false into inserted
- if verticalSort then get top of item i of objectList
- else get left of item i of objectList
- repeat with j = 1 to the number of items in sortedList
- if (verticalSort and (it < top of item j of sortedList)) or (not verticalSort and (it < left of item j of sortedList)) then
- put item i of objectList & "," before item j of sortedList
- put true into inserted
- exit repeat
- end if
- end repeat
- if inserted is false then put item i of objectList & "," after sortedList
- end repeat
- delete last char of sortedList
- put sortedList into objectList
- end SortGroup
-
- on WithinRect selectRect
- global objectList
- repeat with i = the number of card buttons down to 1
- if the loc of card button i is within selectRect then
- if visible of card button i
- then put "card button id " & the id of card button i & "," after objectList
- end if
- end repeat
- repeat with i = the number of card fields down to 1
- if the loc of card field i is within selectRect then
- if visible of card field i
- then put "card field id " & the id of card field i & "," after objectList
- end if
- end repeat
- repeat with i = the number of bkgnd buttons down to 1
- if the loc of bkgnd button i is within selectRect then
- if visible of bkgnd button i
- then put "bkgnd button id " & the id of bkgnd button i & "," after objectList
- end if
- end repeat
- repeat with i = the number of bkgnd fields down to 1
- if the loc of bkgnd field i is within selectRect then
- if visible of bkgnd field i
- then put "bkgnd field id " & the id of bkgnd field i & "," after objectList
- end if
- end repeat
- end WithinRect
-
- ---------------------------------------------------------------------
- -- GROUPIES HANDLERS END HERE
- ---------------------------------------------------------------------
-
-
-